<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>讨论区</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="${pageContext.request.contextPath}/static/css/bootstrap.css"
	rel="stylesheet" media="screen">
<!-- Custom CSS -->
<link href="${pageContext.request.contextPath}/static/css/main.css"
	rel="stylesheet">
<script src="${pageContext.request.contextPath}/static/js/jquery-1.js"></script>
</head>
<body>
	<div class="container">
		<header>
			<div id="logo">
				<img src="${pageContext.request.contextPath}/static/img/logo.png"
					alt="">
			</div>
			<nav class="navbar navbar-default">
				<div class="navbar-header">
					<button type="button" class="navbar-toggle" data-toggle="collapse"
						data-target="#navbar-collapse-menu">
						<span class="sr-only">Toggle navigation</span> <span
							class="icon-bar"></span> <span class="icon-bar"></span> <span
							class="icon-bar"></span>
					</button>
					<a class="navbar-brand" href="#">首页</a>
				</div>
				<div class="collapse navbar-collapse" id="navbar-collapse-menu">
					<form action="${pageContext.request.contextPath}/topic" method="get"
						class="navbar-form navbar-left" role="search">
						<div class="form-group">
						    <input type="hidden" name="fid" value="${param.fid}">
							<input name="keyWord" class="form-control" placeholder="主题"
								type="text" value="${param.keyWord}">
						</div>
						<button type="submit" class="btn btn-default">搜索</button>
					</form>
					<ul class="nav navbar-nav navbar-right">
						<li><a href="loginOut">注销</a></li>
						<li><a>${loginUser.nickname}</a></li>
					</ul>
				</div>
			</nav>
		</header>
		<div class="content">
			<ol class="breadcrumb">
				<li><a href="#">首页</a></li>
				<li><a href="#">讨论区</a></li>
			</ol>
				<div class="row">
					<div class="col-md-12">
						<div class="panel panel-default">
							<!-- Default panel contents -->
							<div class="panel-heading">${forum.name}-精华区</div>
							<!-- Table -->
							<table class="table">
								<thead style="font-weight: bold">
									<td>主题</td>
									<td>作者</td>
									<td>回复</td>
									<td>最后更新时间</td>
								</thead>
								<tbody>
									<c:if test="${!bestTopic.isEmpty()}">
									<c:forEach var="t" items="${bestTopic}">
										<tr>
											<td>${t.title}</td>
											<td>${t.author.nickname}</td>
											<td>${t.commentTimes}</td>
											<td>${t.updateTime}</td>
										</tr>
									</c:forEach>
									</c:if>
									<c:if test="${bestTopic.isEmpty()}">
									<tr>
										<td colspan="4" style="text-align: center;">未找到相关信息</td>
									</tr>
									</c:if>
								</tbody>
							</table>
						</div>
					</div>
					<div class="col-md-12">
						<div class="panel panel-default">
							<!-- Default panel contents -->
							<div class="panel-heading">${forum.name}-讨论区</div>
							<!-- Table -->
							<table class="table">
								<thead style="font-weight: bold">
									<td>主题</td>
									<td>作者</td>
									<td>回复</td>
									<td>最后更新时间</td>
								</thead>
								<tbody>
									<c:if test="${!normalTopic.isEmpty()}">
									<c:forEach var="n" items="${normalTopic}">
										<tr>
											<td>${n.title}</td>
											<td>${n.author.nickname}</td>
											<td>${n.commentTimes}</td>
											<td>${n.updateTime}</td>
										</tr>
									</c:forEach>
									</c:if>
									<c:if test="${normalTopic.isEmpty()}">
									<tr>
										<td colspan="4" style="text-align: center;">未找到相关信息</td>
									</tr>
									</c:if>
								</tbody>
							</table>
						</div>
						<nav aria-label="Page navigation">
							<ul class="pagination">
								<li>
									<a href="?fid=${param.fid}&keyWord=${param.keyWord}&pageNum=1">
									<span aria-hidden="true">&lt;&lt;</span>
									</a>
								</li>
								<c:forEach begin="1" end="${totalPage}" step="1" varStatus="s">
								<li>
									<a href="?fid=${param.fid}&keyWord=${param.keyWord}&pageNum=${s.index}">${s.index}</a>
								</li>
								</c:forEach>
								<li>
									<a href="?fid=${param.fid}&keyWord=${param.keyWord}&pageNum=${totalPage}">
									<span aria-hidden="true">&gt;&gt;</span>
									</a>
								</li>
								<li><span>第${pageNum}页，共${totalPage}页</span></li>
							</ul>
						</nav>
					</div>
				</div>
		</div>
		<footer id="footer" class="panel-footer">
			<p>手机论坛 xda.cn</p>
			<p>Designed by Sam Chen</p>
		</footer>
	</div>
	<script src="${pageContext.request.contextPath}/static/js/bootstrap.js"></script>
</body>
</html>